package com.mjk.manager.workflow;

import com.mjk.common.base.request.BaseDto;
import com.mjk.common.tools.gson.GsonUtils;
import com.mjk.common.tools.logger.BizLogger;
import com.mjk.manager.workflow.component.dto.BeeLiteFlowContext;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.flow.LiteflowResponse;
import com.yomahub.liteflow.slot.DefaultContext;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

//@Component
public class LiteFlowCommand implements CommandLineRunner{
	
    @Resource
    private FlowExecutor flowExecutor;

    @Override
    public void run(String... args) throws Exception {
        while(true){
            BeeLiteFlowContext dto = new BeeLiteFlowContext();
            dto.setData("work","test");
            LiteflowResponse response = flowExecutor.execute2Resp("chain1",null, dto);

            if (response.isSuccess()){
                BizLogger.info("执行成功");
            }else{
                BizLogger.info("执行失败");
            }
            Thread.sleep(10000);
        }
    }
}
